from sqlalchemy import Column, Integer, String, Text, Boolean, BigInteger, TIMESTAMP
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()


# 用户反馈
class feedbackDo(Base):
    __table_args__ = {'extend_existing': True}
    __tablename__ = "feedback"
    id = Column(String)
    user_name = Column(String)
    page_position = Column(String)
    level = Column(String)
    description = Column(String)
    attachment = Column(String)
    create_time = Column(Integer)
    __mapper_args__ = {
        "primary_key": [id]
    }


# Beta车辆映射类
class betaRawDataDo(Base):
    __table_args__ = {'extend_existing': True}
    __tablename__ = "beta_raw_data"

    uuid = Column(String)
    data_ts = Column(Integer)
    trigger_id = Column(Integer)
    ota_version = Column(String)
    __mapper_args__ = {
        "primary_key": [uuid, data_ts, trigger_id, ota_version]
    }


# 车主管理表映射类
class vehicleInfoMngtDo(Base):
    __table_args__ = {'extend_existing': True}
    __tablename__ = "vehicle_info_mngt"

    int_vehicle_no = Column(String)
    manager = Column(String)
    level = Column(Integer)
    vehicle_tested_by = Column(String)
    vehicle_status = Column(String)
    bosch_no = Column(String)
    ota_version = Column(String)
    chery_no = Column(String)
    vin = Column(String)
    adcc_sn = Column(String)
    adcc_hardware = Column(String)
    vehicle_is_deploy = Column(String)
    cloud = Column(String)
    opl = Column(String)
    commetns = Column(String)
    __mapper_args__ = {
        "primary_key": [int_vehicle_no, manager, level]
    }


# 文件质量表映射类
class filesCompleteness(Base):
    __table_args__ = {'extend_existing': True}
    __tablename__ = "files_completeness"
    uuid = Column(String)
    data_ts = Column(Integer)
    tid = Column(Integer)
    ota_version = Column(String)
    integrity = Column(Boolean)
    need_mbag = Column(Boolean)
    missing_of_mbag = Column(Boolean)
    missing_categories = Column(String)
    package_size = Column(BigInteger)
    file_nums = Column(Integer)
    missing = Column(String)
    current_files = Column(String)
    comment = Column(String)
    upload_time = Column(TIMESTAMP)
    __mapper_args__ = {
        "primary_key": [uuid, data_ts, tid, package_size, file_nums]
    }


# triggerid详情管理表映射类
class triggerIdInfoMngt(Base):
    __table_args__ = {'extend_existing': True}
    __tablename__ = "trigger_id_info_mngt"
    trigger_id = Column(Integer)
    total_type = Column(String)
    sub_type = Column(String)
    interfere_type = Column(String)
    retrun_describe = Column(Text)
    remarks = Column(Text)
    event_type_id = Column(Integer)
    event_seq_no = Column(Integer)
    level = Column(Integer)
    involve_function = Column(String)
    trigger_scene = Column(String)
    scene_status = Column(String)
    demand_source = Column(String)
    win_ii_is_impl = Column(String)
    ota_5_new_trigger = Column(String)
    bosch_trigger_condition = Column(String)
    wr_trigger_condition = Column(String)
    other = Column(String)
    __mapper_args__ = {
        "primary_key": [trigger_id]
    }
